package com.jxgyl.gateway.controller;

import com.jxgyl.api.RemoteTestService;
import com.jxgyl.common.data.R;
import com.jxgyl.gateway.config.GateWayConfig;
import com.jxgyl.gateway.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

/**
 * @program: middleplatform
 * @description:
 * @author: Wanglipeng
 * @create: 2022-01-20 16:28
 **/
@Controller
public class TestController {



    @Autowired
    TestService testService;


    @RequestMapping(value = "/test")
    @ResponseBody
    public String test(){
        System.out.println("ttttttt");
        Future<String> a= testService.test();
        System.out.println("a="+a);
        try {
            return "returnnn_"+a.get();
        } catch (InterruptedException e) {
            e.printStackTrace();
            return "error";
        } catch (ExecutionException e) {
            e.printStackTrace();
            return "error";
        }
    }
}
